package com.seven.springboot.service.yang;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seven.springboot.domain.query.AccountQuery;
import com.seven.springboot.enums.ValidStatus;
import com.seven.springboot.mapper.AccountMapper;
import com.seven.springboot.pojo.Account;
import com.seven.springboot.util.StringUtils;

@Service
public class AccountService {

	@Autowired
	private AccountMapper mapper;
	
	public Account getAccountById(int id) {
		return mapper.selectByPrimaryKey(id);
	}
	
	public Account getAccountByQuery(String accountNo,ValidStatus validStatus) {
		if(StringUtils.isEmpty(accountNo) || validStatus == null) {
			return null;
		}
		AccountQuery query = new AccountQuery();
		query.setAccountNo(accountNo);
		query.setStatus(validStatus.getIndex());
		return mapper.selectByQuery(query);
	}
	
}
